package bookoperations;

import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-05-25
 * Time: 16:02
 */
public class SearchOperation implements IBookOperations{
    @Override
    public void work(BookList booklist) {
        System.out.println("请输入您要查找图书书名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0; i < booklist.getUseSize(); i++) {
            if(booklist.getBook(i).getName().equals(name)){
                System.out.println("查找到您要找的图书！！！");
                System.out.println(booklist.getBook(i).toString());
                return;
            }
        }
        System.out.println("您要查找的图书不存在！！！");
    }
}
